import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class Test3 {
    public static void main(String[] args) {
        LocalDate currentDate = LocalDate.now();
        LocalDateTime currentDateTime = LocalDateTime.now();


        DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");

        String formattedDate = currentDate.format(dateFormatter);
        String formattedDateTime = currentDateTime.format(dateTimeFormatter);

        System.out.println("格式化的日期: " + formattedDate);
        System.out.println("格式化的日期时间: " + formattedDateTime);
    }
}